import request from '@/config/axios'

export interface ProductGroupVO {
  id: number
  name: string
  code: string
  parentId: number
  status: number
  sort: number
  remark: string
}

// 查询产品群组列表
export const getProductGroupList = async (params) => {
  return await request.get({ url: `/base/product-group/list`, params })
}

// 查询产品群组详情
export const getProductGroup = async (id: number) => {
  return await request.get({ url: `/base/product-group/get?id=` + id })
}

// 新增产品群组
export const createProductGroup = async (data: ProductGroupVO) => {
  return await request.post({ url: `/base/product-group/create`, data })
}

// 修改产品群组
export const updateProductGroup = async (data: ProductGroupVO) => {
  return await request.put({ url: `/base/product-group/update`, data })
}

// 删除产品群组
export const deleteProductGroup = async (id: number) => {
  return await request.delete({ url: `/base/product-group/delete?id=` + id })
}

// 导出产品群组 Excel
export const exportProductGroup = async (params) => {
  return await request.download({ url: `/base/product-group/export-excel`, params })
}